/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta;

/**
 *
 * @author JKorreck
 */
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.basic.Label;

public abstract class SelectModalWindow extends ModalWindow {

    public SelectModalWindow(String id) {
        super(id);


        // Set sizes of this ModalWindow. You can also do this from the HomePage
        // but its not a bad idea to set some good default values.
        setInitialWidth(250);
        setInitialHeight(200);

        setTitle("Select something");

        

        // Set the content panel, implementing the abstract methods
        setContent(new SelectContentPanel(this.getContentId()){
            @Override


            void onCancel(AjaxRequestTarget target) {
//                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                SelectModalWindow.this.onCancel(target);
            }

            void onSelect(AjaxRequestTarget target, String selection) {
//                target.appendJavascript("Wicket.Window.unloadConfirmation = false;");
                SelectModalWindow.this.onSelect(target, selection);
            }
        });
    }

    public void setTitleText(String message) {
        this.setTitle(message);
    }

    public void setTextMessage(String text) {
        SelectContentPanel panel = ((SelectContentPanel) this.get(this.getContentId()));
        panel.setMessageText(text);
    }
    
    abstract void onCancel(AjaxRequestTarget target);

    abstract void onSelect(AjaxRequestTarget target, String selection);

}
